/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2024-04-02 10:53:07
 * @LastEditors: huangtianyang
 * @LastEditTime: 2024-04-28 18:43:50
 * @FilePath: \cxl-driving-training\src\apis\store\index.ts
 */
import axios from '../../axios/index'

export interface storeOperationInterface {
    addressDetail?: string //详细地址
    city?: string //城市
    id?: string
    lat?: number //	纬度
    lng?: number //	经度
    name?: string //门店名称
    regionId?: string //区id
    schoolId?: string //驾校id
    regionName?: string //区名称
}

export interface storeListInterface {
    name?: string
    current?: number
    disable?: number
    size?: number
}

//新增门店
export const createStore = (data: storeOperationInterface) => {
    return axios({
        method: 'post',
        url: '/api/system/schoolStore/manage/add',
        data
    })
}

//编辑门店
export const editStore = (data: storeOperationInterface) => {
    return axios({
        method: 'post',
        url: '/api/system/schoolStore/manage/edit',
        data
    })
}

//获取门店信息
export const storeDetails = (id: string) => {
    return axios({
        method: 'get',
        url: '/api/system/schoolStore/manage/getDetailById',
        params: { id }
    })
}

//门店分页
export const storeList = (params: storeListInterface) => {
    return axios({
        method: 'get',
        url: '/api/system/schoolStore/manage/getPageList',
        params
    })
}

/**
 * 启用/禁用
 * @param disable 0.可用；1.禁用
 * @param id
 * @returns
 */
export const storeDisable = (disable: number, id: string) => {
    return axios({
        method: 'post',
        url: '/api/system/schoolStore/manage/updateDisable',
        data: { disable, id }
    })
}
